import { my_request } from '@/utils/http'
// 登录
type LoginParam = {
  code: string
  encryptedData: string
  iv: string
}

// 登录返回参数类型
export type LoginResult = {
  account: string
  avatar: string
  id: string
  mobile: string
  nickname: string
  token: string
}
// 生产环境登录
export const wxLoginAPI = (data: LoginParam) => {
  return my_request<LoginResult>({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

// 开发环境登录
export const wxLoginDevAPI = (phoneNumber: string = '13222222222') => {
  return my_request<LoginResult>({
    method: 'POST',
    url: '/login/wxMin/simple',
    data: {
      phoneNumber,
    },
  })
}
